import React from 'react'
import { Outlet, Navigate, useLocation } from 'react-router-dom'
import Tabbar from './compoents/Tabbar'
function App() {
  const { pathname } = useLocation()
  const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null

  if (!token) {
    return <Navigate to="/login" replace state={{ from: pathname }} />
  }

  return (
    <div>
      <Outlet/>
      <Tabbar/>
    </div>
  )
}

export default App
